package com.bw.controller;

import cn.hutool.poi.excel.ExcelUtil;
import com.bw.entity.Bing;
import com.bw.entity.Zxt;
import com.bw.mapper.ZxtMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class TuController {


    @Autowired
    ZxtMapper zxtMapper;

    @RequestMapping("/tu.do")
    public String tu(){

        return "tu";
    }


    @RequestMapping("/zxt.do")
    @ResponseBody
    public List<Zxt> zxt(String group){

       List<Zxt>  list = zxtMapper.zxt(group);

        return  list;
    }

    @RequestMapping("/bing.do")
    @ResponseBody
    public List<Bing> bing(String group){

       List<Bing>  list = zxtMapper.bing(group);

        return  list;
    }

    @RequestMapping("/excel.do")
    public void excel(String group, HttpServletResponse response){

       List<Bing>  list = zxtMapper.bing(group);

        ExcelUtils.exportExcel(list,"学生数量导出","这是sheet1",response);

    }
}
